package com.xk;

import com.xk.mapper.TeacherMapper;
import com.xk.mapper.UserMapper;
import com.xk.pojo.Page;
import com.xk.pojo.Teacher;
import com.xk.pojo.User;
import com.xk.service.TeacherService;
import com.xk.service.impl.TeacherServiceImpl;
import com.xk.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class App {

    public static void main(String[] args) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();

//        TeacherMapper mapper = sqlSession.getMapper(TeacherMapper.class);
//        Teacher teacher=new Teacher();
//        teacher.setTeacherID(11);
//        teacher.setName("kkk");
//        mapper.updateTeacherById(teacher);

//        List<Teacher> teacherListByPage =
//                mapper.getTeacherListByPage(1, 6);
//        System.out.println(teacherListByPage);

//        List<Teacher> teachers = mapper.getTeacherByName("张");
//        for (Teacher teacher : teachers) {
//            System.out.println(teacher);
//        }
//
//        TeacherService teacherService=new TeacherServiceImpl();
//        teacherService.deleteTeacherById(13);
                TeacherMapper mapper = sqlSession.getMapper(TeacherMapper.class);
        UserMapper userMapper=sqlSession.getMapper(UserMapper.class);
        User user=new User();
        user.setUsername("admin");
        user.setPassword("123456");
        boolean checklogin = userMapper.checklogin(user);
        System.out.println(checklogin);

        sqlSession.commit();
        sqlSession.close();

    }


}
